<template>
  <div class="Left">
  <el-menu
      default-active="2"
      class="el-menu-vertical-demo"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b">
      <el-submenu v-for="item in adminList" :key="item.id" :index="item.id" >
        <template slot="title">
          <i :class="item.icon"></i>
          <span>{{item.title}}</span>
        </template>
        <el-menu-item-group v-for="(chil,index) in item.chil" :key="index">
          <el-menu-item :index="chil.id" @click="Url(chil.url)">{{chil.title}}</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
    </el-menu>
    </div>
</template>

<script>
import {mapState} from 'vuex'
export default {
  computed:{
    ...mapState(['adminList'])
  },methods:{
    Url(url){
      if(url){
        this.$router.push(url).catch(err=>{
          console.log(err);
        });
      }
    }
  }
}
</script>

<style lang="scss" scopd>
 .Left{
   width: 300px;
   height:100vh;
   background-color:#545c64;
 }
</style>